﻿using sql_data_generator.FieldOptions;
using sql_data_generator.Generators;

namespace sql_data_generator.Randomizers
{
    class RandomizerIPv6Address : BaseRandomizer<FieldOptionsIPv6Address>, IRandomizer
    {
        private readonly RandomIntegerGenerator _generator = new RandomIntegerGenerator(0, 0xffff);

        public RandomizerIPv6Address(FieldOptionsIPv6Address options)
            : base(options)
        {
        }

        public object GetData()
        {
            // Example 2001:0:5ef5:79fd:38e2:30c1:ad54:e6f8
            return IsNull() ? null : string.Format("2001:0:{0:X}:{1:X}:{2:X}:{3:X}:{4:X}:{5:X}",
                _generator.Generate(), _generator.Generate(), _generator.Generate(), _generator.Generate(), _generator.Generate(), _generator.Generate());
        }
    }
}